<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>v-model值绑定</title>
    <script src="../lib/vue_v2.6.14.js"></script>
  </head>
  <body>
    <div id="app">
      <label :for="item.id" v-for="item in hobbys" :key="item.id"> <input type="checkbox" :id="item.id" :value="item.value" v-model="selectHobby" />{{ item.value }} </label>
      <h3>你选中了：{{ selectHobby }}</h3>
    </div>

    <script>
      const vm = new Vue({
        el: '#app',
        data: {
          hobbys: [
            { id: 1, value: '篮球' },
            { id: 2, value: '足球' },
            { id: 3, value: '乒乓球' },
            { id: 4, value: '台球' }
          ],
          selectHobby: []
        }
      })
    </script>
  </body>
</html>
